﻿using System;
using System.ComponentModel;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace WPExtensionsDemo
{
    public class BaseViewModel : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        public void OnChange(string name)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this,new PropertyChangedEventArgs(name));
            }
        }
    }
    public class ViewModelDemo : BaseViewModel
    {
        public ViewModelDemo()
        {
            DeleteCommand = new RelayCommand(obj => MessageBox.Show("ICommand param. CommandParam: "+obj));
        }

        private string customText=string.Empty;
        public string CustomText
        {
            get { return customText; }
            set 
            { 
                customText = value;
                OnChange("CustomText");
            }
        }

        private bool appBarIconButtonEnabled=true;
        public bool AppBarIconButtonEnabled
        {
            get
            {
                return appBarIconButtonEnabled;
            }
            set
            {
                appBarIconButtonEnabled = value;
                OnChange("AppBarIconButtonEnabled");
            }
        }

        private string appBarIconButtonText="my text";
        public string AppBarIconButtonText
        {
            get
            {
                return appBarIconButtonText;
            }
            set
            {
                appBarIconButtonText = value;
                OnChange("AppBarIconButtonText");
            }
        }

        private Uri iconUri = new Uri("/Images/appbar.add.rest.png", UriKind.Relative);
        public Uri IconUri
        {
            get { return iconUri; }
            set
            {
                iconUri = value;
                OnChange("IconUri");
            }
        }

        private Visibility visibility;
        public Visibility Visibility
        {
            get { return visibility; }
            set
            {
                visibility = value;
                OnChange("Visibility");
            }
        }

        public ICommand DeleteCommand { get; set; }

        private double opacity=0.8;
        public double Opacity
        {
            get { return opacity; }
            set
            {
                opacity = value;
                OnChange("Opacity");
            }
        }
    }


}
